// 导入已配置的axios实例
import service from '../utils/request';

// 不需要重复设置拦截器，已在request.js中配置

// 重新导出service供其他模块使用
// export default service;

/**
 * 获取待审核的供应商提交记录
 * @param {number} pageNum - 页码
 * @param {number} pageSize - 每页条数
 * @returns {Promise}
 */
export function getQualificationList(pageNum, pageSize) {
  return service({
    url: '/supplier_submission/pending_submission',
    method: 'get',
    params: {
      pageNum,
      pageSize
    }
  });
}

/**
 * 提交资质审核结果
 * @param {object} params - 审核参数
 * @param {number} params.id - 资质ID
 * @param {number} params.status - 审核状态(1:通过, 2:拒绝)
 * @param {string} params.rejectReason - 拒绝原因
 * @returns {Promise}
 */
export function submitQualificationAudit(params) {
  return service({
    url: '/supplier_submission/audit/update',
    method: 'post',
    data: params
  });
}

/**
 * 获取资质审核详情
 * @param {number} id - 资质ID
 * @returns {Promise}
 */
export function getQualificationDetail(id) {
  return service({
    url: `/qualification/detail/${id}`,
    method: 'get'
  });
}

/**
 * 提交资质审核
 * @param {object} params - 资质参数
 * @returns {Promise}
 */
export function submitQualification(params) {
  return service({
    url: '/supplier_submission/submission',
    method: 'post',
    data: params
  });
}